from selenium import webdriver
from time import sleep
import os

driver = webdriver.Chrome(r'E:\Google\chromedriver.exe')  # 浏览器插件地址
# a = driver.get("http://lanling.66ip.net:18089/#/login")  # 打开网站（测试环境）
# a = driver.get("http://192.168.1.24:8090/#/login")  # 打开网站（预生产环境）
# a = driver.get("http://dc.nt2j.cn:2021/#/login")  # 打开网站（生产环境）
sleep(1)
driver.find_element_by_xpath('//*[@id="app"]/div/div/form/div[1]/div/div/input').send_keys('LM99999')  # 用户名输入
sleep(1)
driver.find_element_by_xpath('//*[@id="app"]/div/div/form/div[2]/div/div/input').send_keys('123456789a')  # 密码输入
sleep(1)
driver.find_element_by_xpath('//*[@id="app"]/div/div/form/div[4]/div/button').click()  # 点击登录
sleep(1)
driver.find_element_by_xpath('//*[@id="app"]/div/div[3]/div[1]/span[2]').click()  # 选择租户
sleep(1)
driver.find_element_by_xpath('//*[@id="app"]/div/div[2]/section/div/div[1]/ul/li[2]').click()  # 选择系统
sleep(1)
driver.find_element_by_xpath('//*[@id="app"]/div/div[1]/div[2]/div[1]/div/div/div[1]/span/span/i').click()  # 选择公司
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[1]/div[2]/div[1]/div/div/div[2]/div[1]/div[1]/ul/li/div/div[1]/div[2]/div/div[2]/div/div[1]/span[2]').click()  # 选择项目
sleep(1)
driver.find_element_by_xpath('//*[@id="app"]/div/div[1]/div[1]/div[2]/ul/div[9]/a/li').click()  # 选择人员管理
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[1]/div/div[2]/div/button[1]').click()  # 选择登记进场
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[4]/div[1]/div/div/button').click()  # 选择上传图片1
"""//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[4]/div[1]/div/div/button"""
sleep(1)
os.system(r'D:\soft\AutoIt\1.exe')  # 本地文件路径1
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[4]/div[2]/div/div/button').click()  # 选择上传图片2
sleep(1)
os.system(r'D:\soft\AutoIt\2.exe')  # 本地文件路径2
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[4]/div[3]/div/div/button').click()  # 选择上传图片3
sleep(1)
os.system(r'D:\soft\AutoIt\3.exe')  # 本地文件路径3
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[6]/div/div/input').send_keys(
    '甜甜')  # 输入姓名
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[7]/div/div/div/input').click()  # 选择性别
sleep(1)
driver.find_element_by_xpath(
    '/html/body/div[3]/div[1]/div[1]/ul/li[2]/span').click()  # 选择性别
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[8]/div/div/div').click()  # 选择民族
sleep(1)
driver.find_element_by_xpath(
    '/html/body/div[4]/div[1]/div[1]/ul/li[1]').click()  # 选择民族
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[9]/div/div/input').send_keys(
    '13010219900307475X')  # 输入身份证号
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[12]/div/div/input').click()  # 选择出生日期
sleep(1)
driver.find_element_by_xpath(
    '/html/body/div[5]/div[1]/div/div[2]/table[1]/tbody/tr[2]/td[2]/div').click()  # 选择出生日期
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[13]/div/div/input').send_keys(
    '15318099928')  # 输入手机号
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[15]/div/div/input').send_keys(
    '北京市东城区')  # 输入签发机关
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[16]/div/label/span[1]/span').click()  # 选择证件有效期
sleep(1)
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[17]/div/div/textarea').send_keys(
    '北京市东城区')  # 输入证件地址
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[26]/div/div/div/div[1]/span/span/i').click()
sleep(1)  # 添加班组
driver.find_element_by_xpath(
    '/html/body/div[6]/div[1]/div[1]/ul/li[1]/span').click()
sleep(1)  # 添加班组
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[29]/div/div/div/span/span/i').click()  # 添加岗位类型
sleep(1)
driver.find_element_by_xpath(
    '/html/body/div[7]/div[1]/div[1]/ul/li/span').click()
sleep(1)  # 添加岗位类型
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[2]/div[2]/form/div[32]/div/div/div[1]/input').click()
sleep(1)  # 添加岗位
driver.find_element_by_xpath(
    '/html/body/div[8]/div[1]/div[1]/ul/li[2]').click()
sleep(1)  # 添加岗位
driver.find_element_by_xpath(
    '//*[@id="app"]/div/div[3]/section/div/div/div[2]/div[2]/div/div[3]/span/button[2]').click()
sleep(1)  # 确定

# driver.quit()#退出
